﻿<html>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function validate(){
	var digits="0123456789"
	var temp
	if (document.testform.Name.value=="") {
		alert("No Name !")
		return false
	}
	if (document.testform.age.value=="") {
		alert("Invalid Age !")
		return false
	}
	
	if (document.testform.sex[0].checked == false && document.testform.sex[1].checked == false) {
		alert("Chưa check vào giới tính !")
		return false
	}
	for (var i=0;i<document.testform.age.value.length;i++){
		temp=document.testform.age.value.substring(i,i+1)
		if (digits.indexOf(temp)==-1){
			alert("Invalid Age !")
			return false
		}
	}
	return true
}
// End -->
</SCRIPT>
</head>
<BODY>
<FORM name="testform" onSubmit="return validate()">
Name:<input type="text" size=30 name="Name"> <br><br>
Age:<input type="text" size=3 name="age"><br><br>
Sex:<input type="radio" value="0" name="sex">Nam &nbsp;&nbsp;<input type="radio" value="1" name="sex">Nu<br><br>
<input type="submit" value="Submit">
</FORM>
</BODY>
</HTML>